<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.example.pojo.User" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>MobileWorld - 首页</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f3f4f6;
            color: #333;
        }
        header {
            background-color: #0078D7;
            color: white;
            padding: 2rem;
            text-align: center;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }
        header h1 {
            margin: 0;
            font-size: 2.5rem;
            animation: fadeInDown 0.8s ease-out;
        }
        header p {
            font-size: 1.2rem;
        }
        .container {
            max-width: 900px;
            margin: 2rem auto;
            padding: 2rem;
            text-align: center;
            background: white;
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            animation: fadeInUp 0.8s ease-out;
        }
        .welcome {
            font-size: 1.5rem;
            margin-bottom: 2rem;
            color: #555;
        }
        nav {
            margin-top: 1.5rem;
            display: flex;
            justify-content: center;
            gap: 1rem;
        }
        nav a {
            text-decoration: none;
            color: white;
            font-weight: bold;
            padding: 0.8rem 1.5rem;
            border-radius: 5px;
            background-color: #0078D7;
            transition: background-color 0.3s ease;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        nav a:hover {
            background-color: #005bb5;
        }
        nav a i {
            font-size: 1.2rem;
        }
        footer {
            background-color: #333;
            color: white;
            text-align: center;
            padding: 1rem;
            position: fixed;
            width: 100%;
            bottom: 0;
            box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.1);
        }
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        @keyframes fadeInDown {
            from {
                opacity: 0;
                transform: translateY(-20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
    </style>
</head>
<body>
<header>
    <h1><i class="fas fa-mobile-alt"></i> 欢迎来到 MobileWorld</h1>
    <p>您的一站式手机购物平台</p>
</header>
<div class="container">
    <%
        User user = (User) session.getAttribute("user");
        if (user == null) {
    %>
    <div class="welcome">
        您尚未登录，请先 <a href="login.jsp" style="color: #0078D7; text-decoration: underline;">登录</a>。
    </div>
    <% } else { %>
    <div class="welcome">
        欢迎回来，<b><%= user.getUsername() %></b>！
    </div>
    <nav>
        <a href="products"><i class="fas fa-box"></i> 商品管理</a>
        <a href="orders"><i class="fas fa-shopping-cart"></i> 我的订单</a>
        <a href="logout"><i class="fas fa-sign-out-alt"></i> 退出登录</a>
    </nav>
    <% } %>
</div>
<footer>
    &copy; 2024 MobileWorld. 保留所有权利.
</footer>
</body>
</html>
